package com.note.chh.notebook.dao;

import java.util.Map;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.AbstractDaoSession;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.identityscope.IdentityScopeType;
import org.greenrobot.greendao.internal.DaoConfig;

import com.note.chh.notebook.Model.Note;
import com.note.chh.notebook.Model.Stroke;

import com.note.chh.notebook.dao.NoteDao;
import com.note.chh.notebook.dao.StrokeDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see org.greenrobot.greendao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig noteDaoConfig;
    private final DaoConfig strokeDaoConfig;

    private final NoteDao noteDao;
    private final StrokeDao strokeDao;

    public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        noteDaoConfig = daoConfigMap.get(NoteDao.class).clone();
        noteDaoConfig.initIdentityScope(type);

        strokeDaoConfig = daoConfigMap.get(StrokeDao.class).clone();
        strokeDaoConfig.initIdentityScope(type);

        noteDao = new NoteDao(noteDaoConfig, this);
        strokeDao = new StrokeDao(strokeDaoConfig, this);

        registerDao(Note.class, noteDao);
        registerDao(Stroke.class, strokeDao);
    }
    
    public void clear() {
        noteDaoConfig.clearIdentityScope();
        strokeDaoConfig.clearIdentityScope();
    }

    public NoteDao getNoteDao() {
        return noteDao;
    }

    public StrokeDao getStrokeDao() {
        return strokeDao;
    }

}
